package com.centerm.common.constant.enums.project;

import com.centerm.common.constant.StatusCode;

/**
 * @ClassName: enum ProjectMemberRole
 * @Description: 项目成员角色
 * @author lk
 * @date 2017年7月21日
 */
public enum ProjectMemberRole implements StatusCode {
    
    UNALLOACTED(0, "无"),
    REQUIREMENT(1, "需求"),
    DEVELOPER(2, "开发"),
    TEST(3, "测试");

    private Integer code;
    private String description;
    
    private ProjectMemberRole(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getDescription() {
        return this.description;
    }

    public static ProjectMemberRole getByCode(Integer code) {
        for(ProjectMemberRole role : ProjectMemberRole.values()) {
            if(role.getCode().equals(code)) {
                return role;
            }
        }
        return null;
    }


    public static String getDescriptionByCode(Integer code) {
        for(ProjectMemberRole role : ProjectMemberRole.values()) {
            if(role.getCode().equals(code)) {
                return role.getDescription();
            }
        }
        return null;
    }
}
